home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5445 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  893 b 

  1. Path: mail2news.demon.co.uk!ues5.cern.ch
  2. From: Dan Pop <Dan.Pop@cern.ch>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: fwrite help?
  5. Date: Mon, 12 Feb 1996 13:53:45 +0100
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <9602121253.AA29675@ues5.cern.ch>
  8. References: <4fmaig$7of@news.global1.net>
  9. X-NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11. X-Mail2News-Path: mail1.cern.ch!ues5.cern.ch
  12.  
  13. youngrc@global1.net writes:
  14.  
  15. >What would the syntax for fwrite be to output 8 characters of 
  16. >char line[10] to a file?  K&R doesn't write much about it. Thanks
  17. >for the help.
  18.  
  19. I disagree.  Page 247 of K&R2 contains all the information you need.
  20.  
  21. Anyway, the solution is:
  22.  
  23.     fwrite(line, sizeof *line, 8, fp); /* or fwrite(line, 1, 8, fp) */
  24.  
  25. Dan
  26. -- 
  27. Dan Pop
  28. CERN, CN Division
  29. Email: danpop@mail.cern.ch 
  30. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  31.